<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        table {
            width: 300px;
            border: 1px solid #ccc;
            border-collapse: collapse;
            border-spacing: 0;
            margin: 100px auto;
            
        }
        th,td {
            border: 1px solid #ccc;
        }
        td {
            text-align: center;
        }
    </style>
</head>
<body>
    <table>
        <thead>
            <th>姓名</th>
            <th>科目</th>
            <th>成绩</th>
            <th>操作</th>
        </thead>
        <tbody>
  
        </tbody>
    </table>
    <script>
        var tbody = document.querySelector('tbody')
        var data = [
            {
                 name:'zs',
                 subject:'语文',
                 score:70
        },
            {
                 name:'li',
                 subject:'语文',
                 score:70
        },
            {
                 name:'ww',
                 subject:'语文',
                 score:70
        }
        ]
        for(var i=0;i<data.length;i++){
                 var tr =  document.createElement('tr');
                 tbody.appendChild(tr)
                 for(var key in data[i]){
                   var td =   document.createElement('td');
                   td.innerHTML = data[i][key];
                   tr.appendChild(td);
                 }
                 var td = document.createElement('td');
                 td.innerHTML = '<a href="javascript:;" id="a">删除</a>'
                 tr.appendChild(td);
                  
        }
        var as = document.querySelectorAll('a')
        for(var i = 0;i<as.length;i++){
            as[i].onclick = function(){
                tbody.removeChild(this.parentNode.parentNode)
            }
        }
    </script>
</body>
</html>